package com.symone.webcms.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.symone.webcms.mapper.LanguageMapper;
import com.symone.webcms.model.Language;
import com.symone.webcms.service.LanguageService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *　　
 *   @description : SysLanguage 服务实现类
 *   ---------------------------------
 * 	 @author Archer Chu
 *   @since 2018-12-05
 */
@Service
public class LanguageServiceImpl extends ServiceImpl<LanguageMapper, Language> implements LanguageService {

    @Override
    public Page<Language> findPage(Page<Language> page, Wrapper<Language> language) {
        List<Language> result = baseMapper.selectPage(page,language);
        page.setRecords(result);
        return page;
    }

    @Override
    public List<Language> findAll() {
        Wrapper<Language> ew = new EntityWrapper<Language>();
        ew.where("deleted=0");
        return baseMapper.selectList(ew);
    }

    @Override
    public int delete(long id) {
        return baseMapper.deleteById(id);
    }

    @Override
    public boolean deleteFlagById(long id) {
        return baseMapper.deleteFlagById(id);
    }

    @Override
    public int clear() {
        return baseMapper.delete(new EntityWrapper<Language>().eq("deleted" ,1));
    }
	
}
